# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Balló György <ballogyor+arch at gmail dot com>

pkgbase=libhandy
pkgname=(libhandy libhandy-docs)
pkgver=1.8.2
pkgrel=1
pkgdesc="Library full of GTK+ widgets for mobile phones"
url="https://gitlab.gnome.org/GNOME/libhandy"
arch=(x86_64)
license=(LGPL)
depends=(
  glib2
  gtk3
)
makedepends=(
  gi-docgen
  git
  glade
  gobject-introspection
  meson
  vala
)
checkdepends=(xorg-server-xvfb)
_commit=48ae7ec0f7f9ee5f666da38b0e39e66874957166  # tags/1.8.2^0
source=("git+https://gitlab.gnome.org/GNOME/libhandy.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd libhandy
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libhandy
}

build() {
  arch-meson libhandy build -D gtk_doc=true
  meson compile -C build
}

check() {
  dbus-run-session xvfb-run -s '-nolisten local' \
    meson test -C build --print-errorlogs
}

package_libhandy() {
  provides=(libhandy-1.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_libhandy-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
